<?php

namespace addons\mental;

use app\common\library\Menu;
use think\Addons;

/**
 * 插件
 */
class Mental extends Addons
{

    /**
     * 插件安装方法
     * @return bool
     */
    public function install()
    {
        $menu = $this->getMenu();
        Menu::create($menu);
        return true;
    }

    /**
     * 插件卸载方法
     * @return bool
     */
    public function uninstall()
    {
        Menu::delete("mental");
        return true;
    }

    /**
     * 插件启用方法
     * @return bool
     */
    public function enable()
    {
        Menu::enable("mental");
        return true;
    }

    /**
     * 插件禁用方法
     * @return bool
     */
    public function disable()
    {
        Menu::disable("mental");
        return true;
    }

    /**
     * 插件更新方法
     * @return bool
     */
    public function upgrade()
    {
        $menu = $this->getMenu();
        Menu::upgrade('mental', $menu);
    }

    /**
     * 菜单
     * @return void
     */
    public function getMenu()
    {
        return [
            [
                'name'    => 'mental',
                'title'   => '心理评测',
                'icon'    => 'fa fa-list',
                'sublist' => [
                    [
                        'name'    => 'mental/category',
                        'title'   => '分类管理',
                        'icon'    => 'fa fa-envira',
                        'sublist' => [
                            ['name' => 'mental/category/index', 'title' => '查看'],
                            ['name' => 'mental/category/add', 'title' => '添加'],
                            ['name' => 'mental/category/edit', 'title' => '编辑'],
                            ['name' => 'mental/category/del', 'title' => '删除'],
                            ['name' => 'mental/category/multi', 'title' => '批量更新'],
                        ]
                    ],
                    [
                        'name'    => 'mental/question',
                        'title'   => '问题管理',
                        'icon'    => 'fa fa-question-circle-o',
                        'sublist' => [
                            ['name' => 'mental/question/index', 'title' => '查看'],
                            ['name' => 'mental/question/recyclebin', 'title' => '回收站'],
                            ['name' => 'mental/question/add', 'title' => '添加'],
                            ['name' => 'mental/question/edit', 'title' => '编辑'],
                            ['name' => 'mental/question/del', 'title' => '删除'],
                            ['name' => 'mental/question/destroy', 'title' => '真实删除'],
                            ['name' => 'mental/question/restore', 'title' => '还原'],
                            ['name' => 'mental/question/multi', 'title' => '批量更新'],
                        ]
                    ],
                    [
                        'name'    => 'mental/test_main',
                        'title'   => '测试管理',
                        'icon'    => 'fa fa-pencil-square',
                        'sublist' => [
                            ['name' => 'mental/test_main/index', 'title' => '查看'],
                            ['name' => 'mental/test_main/add', 'title' => '添加'],
                            ['name' => 'mental/test_main/edit', 'title' => '编辑'],
                            ['name' => 'mental/test_main/del', 'title' => '删除'],
                            ['name' => 'mental/test_main/component', 'title' => '分量结果'],
                            ['name' => 'mental/test_main/multi', 'title' => '批量更新'],
                            ['name' => 'mental/test_main/edit_result', 'title' => '编辑界面'],
                            ['name' => 'mental/test_main/edit_info', 'title' => '编辑更多信息'],
                        ]
                    ],
                    [
                        'name'    => 'mental/testlog',
                        'title'   => '测试记录',
                        'icon'    => 'fa fa-sticky-note-o',
                        'sublist' => [
                            ['name' => 'mental/testlog/index', 'title' => '查看'],
                            ['name' => 'mental/testlog/recyclebin', 'title' => '回收站'],
                            ['name' => 'mental/testlog/add', 'title' => '添加'],
                            ['name' => 'mental/testlog/edit', 'title' => '编辑'],
                            ['name' => 'mental/testlog/del', 'title' => '删除'],
                            ['name' => 'mental/testlog/destroy', 'title' => '真实删除'],
                            ['name' => 'mental/testlog/restore', 'title' => '还原'],
                            ['name' => 'mental/testlog/multi', 'title' => '批量更新'],
                        ]
                    ],
                    [
                        'name'    => 'mental/order',
                        'title'   => '订单管理',
                        'icon'    => 'fa fa-file-text',
                        'sublist' => [
                            ['name' => 'mental/order/index', 'title' => '查看'],
                            ['name' => 'mental/order/add', 'title' => '添加'],
                            ['name' => 'mental/order/edit', 'title' => '编辑'],
                            ['name' => 'mental/order/del', 'title' => '删除'],
                            ['name' => 'mental/order/multi', 'title' => '批量更新'],
                        ]
                    ],
                    [
                        'name'    => 'mental/config',
                        'title'   => '公共配置',
                        'icon'    => 'fa fa-gear',
                        'sublist' => [
                            ['name' => 'mental/config/index', 'title' => '首页'],
                        ]
                    ],
                    [
                        'name'    => 'mental/report',
                        'title'   => '报表统计',
                        'icon'    => 'fa fa-line-chart',
                        'sublist' => [
                            ['name' => 'mental/report/index', 'title' => '查看'],
                        ]
                    ],
                    [
                        'name'    => 'mental/remark',
                        'title'   => '评价管理',
                        'icon'    => 'fa fa-table',
                        'sublist' => [
                            ['name' => 'mental/remark/index', 'title' => '查看'],
                            ['name' => 'mental/remark/add', 'title' => '添加'],
                            ['name' => 'mental/remark/edit', 'title' => '编辑'],
                            ['name' => 'mental/remark/audit', 'title' => '审核'],
                            ['name' => 'mental/remark/del', 'title' => '删除'],
                            ['name' => 'mental/remark/multi', 'title' => '批量更新'],
                        ]
                    ],
                    [
                        'name'    => 'mental/feedback',
                        'title'   => '意见反馈',
                        'icon'    => 'fa fa-paper-plane',
                        'sublist' => [
                            ['name' => 'mental/feedback/index', 'title' => '查看'],
                            ['name' => 'mental/feedback/add', 'title' => '添加'],
                            ['name' => 'mental/feedback/edit', 'title' => '编辑'],
                            ['name' => 'mental/feedback/del', 'title' => '删除'],
                            ['name' => 'mental/feedback/multi', 'title' => '批量更新'],
                        ]
                    ],
                    [
                        'name'    => 'mental/component',
                        'title'   => '分量管理',
                        'icon'    => 'fa fa-superpowers',
                        'sublist' => [
                            ['name' => 'mental/component/index', 'title' => '查看'],
                            ['name' => 'mental/component/add', 'title' => '添加'],
                            ['name' => 'mental/component/edit', 'title' => '编辑'],
                            ['name' => 'mental/component/del', 'title' => '删除'],
                            ['name' => 'mental/component/multi', 'title' => '批量更新'],
                        ]
                    ],
                    [
                        'name'    => 'mental/preview',
                        'title'   => '在线预览',
                        'icon'    => 'fa fa-mobile',
                        'sublist' => [
                            ['name' => 'mental/preview/index', 'title' => '查看'],
                        ]
                    ],
                ]
            ]
        ];
    }

}
